package handler

import (
	"github.com/gin-gonic/gin"
	"good/global"
	"good/internal/model"
)

func QueryComment(c *gin.Context) {
	var comment []model.Comments
	err := global.DB.Debug().Order("created_at desc").Find(&comment).Error
	if err != nil {
		c.JSON(200, gin.H{
			"code": 500,
			"msg":  "查询失败",
			"data": err.Error(),
		})
		return
	}
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "查询成功",
		"data": comment,
	})
}
